<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>1.姓名案例_异步版本_computed实现</title>
    <!-- 引入Vue -->
    <script type="text/javascript" src="../../vue.js"></script>
  </head>
  <body>
    <!-- 准备好一个容器-->
    <div id="demo">
      <h2>1.姓名案例_异步版本_无法用computed实现</h2>
      姓：<input type="text" v-model="firstName"> <br>
      名：<input type="text" v-model="lastName"> <br>
      全名：<span>{{fullName}}</span>
    </div>

    <script type="text/javascript">
      new Vue({
        el:'#demo',
        data:{
          firstName:'zhang',
          lastName:'san'
        },
        computed: {
          fullName(){
            return setTimeout(() => {
              return this.firstName + '-' + this.lastName
            }, 3000);
          }
        }
      })
    </script>
  </body>
</html>